import { acceptHMRUpdate, defineStore } from "pinia";
import { UserInterface } from "~~/types";

interface userStoreInterface {
  userList: UserInterface[];
}

export const useFriendList = defineStore("friend", {
  state: (): userStoreInterface => {
    return {
      userList: [],
    };
  },
  getters: {
    getUserList: (state) => state.userList,
  },
  actions: {
    setUserList(list: UserInterface[]) {
      this.userList = list;
    },
    setUserListItem(value: UserInterface) {
      this.userList.push(value);
    },
  },
});

if (import.meta.hot) {
  import.meta.hot.accept(acceptHMRUpdate(useFriendList, import.meta.hot));
}
